Xbasic

TOP_RECORDS Function

Syntax

Filter_Expression as C = top_records(count as n[,filter as c])

Arguments

Filter_Expression

An expression that selects records from a table. Numeric

count

A positive number. Numeric

filter

Optional. Default = ".T." (All records). A character filter expression that evaluates to a logical value and selects records from the table.

Description

Return the top 'count' records for a given sort order.

Discussion

A special function used only in queries to return the top Quantity of records in a table for a given sort order. If the optional filter is supplied, only the records selected by the filter are returned. Note : The term "top" does not imply that record values are examined. "Top" means first, given the current sort order.

Example

See Top, Bottom, Nth Record and Random Record Queries for more information. The following query returns the top 10 orders placed after May 1, 2000.

dim tbl as P
dim inx as P
tbl = table.current()
query.filter = "top_records(10, \"orderdate > {5/1/2000}\")"
query.order = "order_total"
inx = tbl.query_create()
topparent.resynch()

See Also